﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyOnlineScheduling
{
    class Program
    {
        static void Main(string[] args)
        {
            int m = 10, n = 100;
            double result;
            Task[] tasks = InstanceGenerator.generateRandomTasks(n);
            Processor[] processors = InstanceGenerator.generateProcessors(m);

            for (int i = 0; i < n; i++)
            {
                tasks[i].displayTask(i);
            }

            SchedulingAlgorithms.ShortestWeightedProcessingTime(processors, tasks);

            result = 0.0;
            for (int i = 0; i < m; i++)
            {
                result += processors[i].weightedEndTime;
                //processors[i].display(i);
                processors[i].clearProcessor();
            }
            Console.WriteLine("\nSWPT, REZULTAT: {0}\n\n", result);

            SchedulingAlgorithms.RandomWithSlightImprovement(processors, tasks);

            result = 0.0;
            for (int i = 0; i < m; i++)
            {
                result += processors[i].weightedEndTime;
                //processors[i].display(i);
                processors[i].clearProcessor();
            }
            Console.WriteLine("\nPRAWIE RANDOM, REZULTAT: {0}\n\n", result);

            SchedulingAlgorithms.PseudoShortestWeightedTimeRemainingFirst(processors, tasks);

            result = 0.0;
            for (int i = 0; i < m; i++)
            {
                result += processors[i].weightedEndTime;
                //processors[i].display(i);
                processors[i].clearProcessor();
            }
            Console.WriteLine("\nPseudo-STRF (wywłaszczanie), REZULTAT: {0}\n\n", result);

            SchedulingAlgorithms.ShortestWeightedTimeRemainingFirst(processors, tasks);

            result = 0.0;
            for (int i = 0; i < m; i++)
            {
                result += processors[i].weightedEndTime;
                //processors[i].display(i);
                processors[i].clearProcessor();
            }
            Console.WriteLine("\nSTRF (wywłaszczanie), REZULTAT: {0}\n\n", result);

            Console.ReadKey();
        }
    }
}
